package phase01.module2.code.question3;

public class PhonePlan extends Plan implements ICallService{
    private int planTime;
    private int numOfSMS;

    public PhonePlan(int planTime, int numOfSMS, double monthlyCharge) {
        super(monthlyCharge);
        setPlanTime(planTime);
        setNumOfSMS(numOfSMS);
    }

    @Override
    public void show() {
        System.out.println("=============================================================");
        System.out.println("通话套餐：");
        System.out.println("通话时长： " + getPlanTime() + "分钟");
        System.out.println("短信条数： " + getNumOfSMS() + "条");
        System.out.println("每月资费： " + getMonthlyCharge() + "元");
    }

    public int getPlanTime() {
        return planTime;
    }

    public void setPlanTime(int planTime) {
        this.planTime = planTime;
    }

    public int getNumOfSMS() {
        return numOfSMS;
    }

    public void setNumOfSMS(int numOfSMS) {
        this.numOfSMS = numOfSMS;
    }

    @Override
    public void call(int callTime, SIM sim) {
        System.out.println("=============================================================");
        Invoice invoice = sim.getInvoice();
        invoice.setCallTime(callTime);
        System.out.println("套餐拨打电话：");
        System.out.println("电话卡：" + sim.getNumber());
        System.out.println("电话卡：" + sim.getUsername());
        System.out.println("通话时长：" + callTime + "分钟");
    }
}
